<template>
    <div>
        <el-dialog title="收货地址" :visible.sync="isShow" :before-close="close" >
            <el-form :model="form" ref="form" label-width="5rem" :rules="rules">
                <el-form-item label="手机号" prop="phone">
                    <el-input v-model="form.phone"></el-input>
                </el-form-item>
                <el-form-item label="昵称" prop="nickname">
                    <el-input v-model="form.nickname"></el-input>
                </el-form-item>
                <el-form-item label="密码">
                    <el-input v-model="form.password" placeholder="留空则不修改！"></el-input>
                </el-form-item>
                <el-form-item label="状态">
                    <el-switch v-model="form.status" :active-value="1" :inactive-value="2"></el-switch>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="close">取 消</el-button>
                <el-button type="primary" @click="submit">确 定</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import {memberedit,memberinfo} from "../../request/api"
import { mapGetters,mapActions } from "vuex"
export default {
    props: ["isShow"],
    data() {
        return {
            form: {
                uid: "",
                nickname: "",
                phone: "",
                password: "",
                status: ""
            },
            rules: {
                phone: [{ required: true, message: "请输入手机号", trigger: "blur" }],
                nickname: [{ required: true, message: "请输入市场价格", trigger: "blur" }],
                password: [{ required: true, message: "请输入密码", trigger: "blur" }]
            },
        }
    },
    methods: {
        ...mapActions({
            getmember:"member/getMemberListActions"
        }),
        lookuup(uid){
            memberinfo({uid}).then(res=>{
                // console.log(res);
               if(res.code==200){
                this.form =res.list
                this.form.password = ""
              
               }
            })
        },
        close() {
            this.$emit("close")
            this.$refs.form.resetFields()
        },
        submit(){
            this.$refs.form.validate((val)=>{
                if(val){
                    memberedit(this.form).then(res=>{
                        // console.log(res);
                        if(res.code==200){
                            this.$message(res.msg);
                           this.getmember()
                           this.close()
                        }
                    })
                }
            })
            

        }

    },
    mounted() { },
    watch: {},
    computed: {},
    filters: {},
    components: {}
}
</script>
<style scoped></style>